import StudioHome from './home/StudioHome.vue'
import StudioDesign from './design/StudioDesign.vue'
import StudioDatabase from './database/StudioDatabase.vue'
import StudioDict from './dict/StudioDict.vue'
import StudioSearchWidget from './search/StudioSearchWidget.vue'
import StudioLayout from "./StudioLayout.vue";
import {RouteRecordRaw} from "vue-router";
import {toRef} from "vue";
import designJsHotAccept from './HotAccept'

export const studioRouterPathPrefix = toRef("");

export function installStudio(Vue, router) {
    // 不要注册
}

export function setupStudioRouter(routerArray: RouteRecordRaw[], pathPrefix = "/studio/") {
    studioRouterPathPrefix.value = pathPrefix;
    routerArray.push({
        path: pathPrefix,
        name: 'OneCodeStudio',
        component: StudioLayout,
        meta: {hidden: true},
        children: StudioRouter
    })
    window['designJsHotAccept'] = designJsHotAccept
}

export const StudioRouter = [
    {
        path: "home",
        component: StudioHome,
        name: "home",
        meta: {title: "home", icon: "homepage", hidden: true, affix: true},
    },
    {
        path: "design",
        component: StudioDesign,
        name: "design",
        meta: {title: "designModule", icon: "homepage", hidden: true, affix: true},
    },
    {
        path: "database",
        component: StudioDatabase,
        name: "database",
        meta: {title: "database", icon: "homepage", hidden: true, affix: true},
    },
    {
        path: "dict",
        component: StudioDict,
        name: "dict",
        meta: {title: "enumDict", icon: "homepage", hidden: true, affix: true},
    },
    {
        path: "searchWidget",
        component: StudioSearchWidget,
        name: "searchWidget",
        meta: {title: "dataDict", icon: "homepage", hidden: true, affix: true},
    },
]